import { configureStore } from '@reduxjs/toolkit'

// import cate from './modules/cate'
const moduleFn = require.context('./modules', false, /\.js$/)
const reducer = moduleFn.keys().reduce((prev, curr) => {
  const name = curr.replace(/^\.\//, '').replace(/\.js$/, '')
  prev[name] = moduleFn(curr).default
  return prev
}, {})

const store = configureStore({
  reducer
})
export default store
